package net.zjitc.servlet;

import net.zjitc.pojo.User;
import net.zjitc.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Created by Administrator on 2018/1/3.
 */

/**
 * 这里也可以用Dispatcher，工具
 * 用注释调用方法
 */
@WebServlet(name = "TestsServlet",urlPatterns = "/testsServlet")
public class TestsServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    /*查询所有用户*/
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        UserService service=new UserService();
        List<User> list=service.findAll();
        System.out.println(list);
    }
}
